function TreeListSelect(){
    this.treeRootText = "根节点";          //根节点名称，默认显示'根节点'
	this.treeRootId = "0";				//根节点的值,与SQL语句选择出来的根节点ID一致
	this.isTreeAsyn = "false";				//设置是否异步加载，默认是同步加载，true即表示开启异步加载
	this.params = "";					//SQL语句的查询参数值, 格式为json   [key:value]
	this.treeRootSqlId = "";			//根节点的查询SQL, 如果不填, 则为treeRootSqlId的值; 可以没有父节点参数 
	this.treeChildSqlId = ""			//必须, 树的查询SQL, 父节点的参数为parent_id
	this.listSqlId = "";				//必须, 用户列表的查询SQL
	this.saveService = ""; 			//可选,但如果为保存时,即为必须
	this.listDataService = "";
	this.selectedValue ="";			    //已选择的值，
	this.selectedText = ""; 		    //已选择的文本
	this.title = "";
}

TreeListSelect.prototype.setTreeRootSqlId = function (treeRootSqlId) 
{
    this.treeRootSqlId = treeRootSqlId;
}
TreeListSelect.prototype.setTreeChildSqlId = function (treeChildSqlId) 
{
    this.treeChildSqlId = treeChildSqlId;
}
TreeListSelect.prototype.setSaveService = function(saveService)
{
    this.saveService = saveService;
}
TreeListSelect.prototype.setListDataService = function (listDataService) {
    this.listDataService = listDataService;
}
TreeListSelect.prototype.setListSqlId = function(listSqlId)
{
	this.listSqlId = listSqlId;
}  
TreeListSelect.prototype.setParams = function(params)
{
	this.params = params;
}
TreeListSelect.prototype.setTitle = function (title)
 {
    this.title = title;
}
TreeListSelect.prototype.setTreeRootId = function (treeRootId) 
{
    this.treeRootId = treeRootId;
}
TreeListSelect.prototype.setTreeRootText = function (treeRootText) 
{
    this.treeRootText = treeRootText;
}
TreeListSelect.prototype.setTreeAsyn = function (isTreeAsyn) 
{
    this.isTreeAsyn = isTreeAsyn;
}

/**
*	弹出带保存功能 选择页面, 点击保存之后直接保存结果, 不会再返回值
*	参数path为当前系统的部署路径
*/
TreeListSelect.prototype.show = function (path) {
    url = this.createUrl(path);
    var dialogParam = new Array();
    if (this.saveService == '') {
        var retVal = showCenterModalDialog(url, 960, 540, dialogParam);
        if (retVal) {
            this.selectedValue = retVal[0];
            this.selectedText = retVal[1];
        }

        return retVal;
    }
    else {
        showCenterModalDialog(url, 960, 540, dialogParam);
        return;
    }
}

//组装URL参数
TreeListSelect.prototype.createUrl = function (path) {
    var url = "treeRootText=" + encodeURIComponent(this.treeRootText);
    url += "&treeRootId=" + this.treeRootId;
    url += "&isTreeAsyn=" + this.isTreeAsyn;
    url += "&params=" + this.params;
    url += "&treeRootSqlId=" + this.treeRootSqlId;
    url += "&treeChildSqlId=" + this.treeChildSqlId;
    url += "&listSqlId=" + this.listSqlId;
    url += "&saveService=" + this.saveService;
    url += "&selectedValue=" + this.selectedValue;
    url += "&selectedText=" + this.selectedText;
    url += "&listDataService=" + this.listDataService;
    
  //  alert(url);
  //  url = encodeURIComponent(url);
    url = path + "/Modules/SecurityConsole/Common/FunctionControl/TreeListSelect/TreeListSelect.aspx?" + url;

    return url;
}
    